package com.tanhua.interceptor;

import com.tanhua.model.User;

public class UserHolder  {

    private static  ThreadLocal<User>  t1 = new ThreadLocal();
        /*
        * 将用户对象，存入threadLocal
        * */
     public  static void set(User user){
         t1.set(user);
     }
     /*
     *从当前线程，获取用户的对象
     * */
     public static User get(){
         return  t1.get();
     }
     /*
     * 获取对象的id
     * */
     public static Long getUserId(){
         return t1.get().getId();
     }
     /*
     * 获取对象的Mobile
     * */
     public static String getMobile(){
         return t1.get().getMobile();
     }
}
